﻿<%@ Page Language="C#" MasterPageFile="~/Game/Game.Master" AutoEventWireup="true" CodeBehind="SystemView.aspx.cs" Inherits="smallDeimos.Game.SystemView" Title="Small Deimos - System view" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Label" Font-Bold="True" Font-Size="X-Large"></asp:Label>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource1" 
        onselectedindexchanged="GridView1_SelectedIndexChanged">
        <Columns>
            <asp:BoundField DataField="PlanetID" HeaderText="ID" 
                SortExpression="PlanetID" />
            <asp:BoundField DataField="PopulationLevel" HeaderText="Population" 
                SortExpression="PopulationLevel" />
            <asp:BoundField DataField="Starbase" HeaderText="Starbase" 
                SortExpression="Starbase" />
            <asp:HyperLinkField HeaderText="Player" DataTextField="PlayerName" DataNavigateUrlFields="PlayerId" DataNavigateUrlFormatString="~/Game/PlayerInfo.aspx?pId={0}"/>
        </Columns>
    </asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        SelectMethod="GetSystemView" TypeName="SD.Database.DataAccess">
        <SelectParameters>
            <asp:QueryStringParameter Name="sId" QueryStringField="sId" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>" 
        SelectCommand="SELECT Planets.PlanetID, Planets.PopulationLevel, Players.PlayerName, Players.PlayerId, CAST(Planets.Starbase AS int) AS Starbase FROM Planets INNER JOIN Players ON Planets.OwnerID = Players.PlayerId WHERE (Planets.SystemID = @sid)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="sid" QueryStringField="sId" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
